import request from '@/utils/request'
// 获取角色列表
export const reqGetRolesList = params => request({
  url: '/sys/role',
  params
})

// 新增角色
export const reqAddRole = data => request({
  method: 'post',
  url: '/sys/role',
  data
})
// 更新角色信息
export const reqUpdateRole = data => request({
  method: 'put',
  url: `/sys/role/${data.id}`,
  data
})

// 删除角色
export const reqDelRole = id => request({
  method: 'delete',
  url: `/sys/role/${id}`
})

// 获取启用的角色列表
export const reqGetEnableRoles = () => request({
  url: '/sys/role/list/enabled'
})

// 获取角色详情
export const reqGetRoleDetail = id => request({
  url: `/sys/role/${id}`
})

// 为角色分配权限
export const reqAssignPers = (id, permIds) => request({
  method: 'put',
  url: '/sys/role/assignPrem',
  data: {
    id,
    permIds
  }
})
